package com.x.provider.oss.service.impl;

import cn.hutool.core.util.StrUtil;
import com.x.provider.oss.service.RedisKeyService;
import org.springframework.stereotype.Service;

@Service
public class RedisKeyServiceImpl implements RedisKeyService {
    private static final String FULL_KEY = "Oss:{}";

    public static final String CONTENT_GREEN_NOTIFY_LOCK_KEY = "ContentGreenNotify:Lock";
    public static final String UPDATE_CONTENT_GREEN_RESULT_LOCK_KEY = "ContentGreenResultUpdate:Lock";

    @Override
    public String getContentReviewNotifyLockKey() {
        return getFullKey(CONTENT_GREEN_NOTIFY_LOCK_KEY);
    }

    @Override
    public String getUpdateContentReviewResultLockKey() {
        return getFullKey(UPDATE_CONTENT_GREEN_RESULT_LOCK_KEY);
    }

    private String getFullKey(CharSequence keyTemplate, Object... params){
        return StrUtil.format(FULL_KEY, StrUtil.format(keyTemplate, params));
    }

}
